<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>优惠券</title>
<%@ include file="/page/wx/include.jsp"%>
<style type="text/css">
.order_nav ul li {
    width: 33.3%
}
</style>
<script>
    $(function() {
        jQuery('.order_nav ul li').click(function() {
            TabSelect(".order_nav ul li", "div.yhq_list", "current", jQuery(this))
        });
        jQuery('.order_nav ul li').eq(0).trigger("click");
    });
    jQuery('#duice').click(function() {
        jQuery('.wthpop').show();
    })
    jQuery('.wthpop>p>span').click(function() {
        jQuery('.wthpop').hide()
    })

    //tab function
    function TabSelect(tab, con, addClass, obj) {
        var jQuery_self = obj;
        var jQuery_nav = jQuery(tab);
        jQuery_nav.removeClass(addClass), jQuery_self.addClass(addClass);
        var jQuery_index = jQuery_nav.index(jQuery_self);
        var jQuery_con = jQuery(con);
        jQuery_con.hide(), jQuery_con.eq(jQuery_index).show();
    }
</script>
</head>
<body style="background: #f5f5f5">
    
    <div class="order_nav">
        <ul>
            <li class="current"><a href="#"><span>未使用<c:if test="${couponGetCount > 0 }">(${couponGetCount })</c:if></span><i></i></a></li>
            <li><a href="#"><span>使用记录<c:if test="${couponUsedCount > 0 }">(${couponUsedCount })</c:if></span><i></i></a></li>
            <li><a href="#"><span>已过期<c:if test="${couponExpCount > 0 }">(${couponExpCount })</c:if></span><i></i></a></li>
        </ul>
    </div>
    <div class="yhq_list">

        <div class="yhq_list_con">
            <ul>
                <c:choose>
                    <c:when test="${empty couponGetList }">
                        <div class="noresult">
					        <p>
					            <i><img src="<%=basePath%>/statics_wx/images/icon_nomoney.png" /></i> <span>你还没有可用优惠券</span>
					        </p>
					    </div>
                    </c:when>
                    <c:otherwise>
                        <c:forEach items="${couponGetList }" var="couponGet">
                            <c:set var="intAmount" value="${fn:substringBefore(couponGet.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substringAfter(couponGet.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substring(smallAmount, 0, 2) }"></c:set>
                            <li>
                                <div class="box5">
                                    <strong> <b style="color: #ff0a37"> <u>￥</u> <span>${intAmount }</span>.${smallAmount }<br /> <em
                                            style="font-size: 0.22rem; color: #bbb; font-style: normal">满<fmt:formatNumber type="number"
                                                    value="${couponGet.conditionAmount }" pattern="0.00" maxFractionDigits="2" />元可用
                                        </em>
                                    </b><i class="icon_top"></i><i class="icon_bottom"></i>
                                    </strong>
                                    <div class="item-info">
                                        <h2>${couponGet.couponName }</h2>
                                        <dl>
                                            <dt>所有商品都可以使用</dt>
                                            <dt><fmt:formatDate value="${couponGet.beginTime }" type="date" /> ~ <fmt:formatDate value="${couponGet.endTime }" type="date" /></dt>
                                        </dl>
                                    </div>
                                    <p style="position: absolute; right: 0.1rem; top: 50%; height: 0.36rem; margin-top: -0.17rem;">
                                        <a href="${rootPath}/wx/product/category_search" style="display: inline-block; width: 1.1rem; height: 0.34rem; line-height: 0.32rem; text-align: center; font-size: 0.18rem; color: #ff0a37; border: 0.02rem solid #ff0a37; border-radius: 0.3rem;">去使用</a>
                                    </p>
                                </div>
                            </li>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div>
    </div>
    <div class="yhq_list">
        <div class="yhq_list_con">
            <ul>
                <c:choose>
                    <c:when test="${empty couponUsedList }">
                        <div class="noresult">
					        <p>
					            <i><img src="<%=basePath%>/statics_wx/images/icon_nomoney.png" /></i> <span>你还没有已用优惠券</span>
					        </p>
					    </div>
                    </c:when>
                    <c:otherwise>
                        <c:forEach items="${couponUsedList }" var="couponUsed">
                            <c:set var="intAmount" value="${fn:substringBefore(couponUsed.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substringAfter(couponUsed.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substring(smallAmount, 0, 2) }"></c:set>
                            <li>
                                <div class="box5">
                                    <strong> <b> <u>￥</u> <span>${intAmount }</span>.${smallAmount }<br />满<fmt:formatNumber type="number"
                                                    value="${couponUsed.conditionAmount }" pattern="0.00" maxFractionDigits="2" />元可用
                                    </b><i class="icon_top"></i><i class="icon_bottom"></i>
                                    </strong>
                                    <div class="item-info">
                                        <h2>${couponUsed.couponName }</h2>
                                        <dl>
                                            <dt>所有商品都可以使用</dt>
                                            <dt><fmt:formatDate value="${couponUsed.beginTime }" type="date" /> ~ <fmt:formatDate value="${couponUsed.endTime }" type="date" /></dt>
                                        </dl>
                                        <b class="icon_ysy"></b>
                                    </div>
                                </div>
                            </li>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div>
    </div>
    <div class="yhq_list">
        <div class="yhq_list_con">
            <ul>
                <c:choose>
                    <c:when test="${empty couponExpList }">
                        <div class="noresult">
					        <p>
					            <i><img src="<%=basePath%>/statics_wx/images/icon_nomoney.png" /></i> <span>你没有过期优惠券</span>
					        </p>
					    </div>
                    </c:when>
                    <c:otherwise>
                        <c:forEach items="${couponExpList }" var="couponExp">
                            <c:set var="intAmount" value="${fn:substringBefore(couponExp.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substringAfter(couponExp.couponAmount, '.') }"></c:set>
                            <c:set var="smallAmount" value="${fn:substring(smallAmount, 0, 2) }"></c:set>
                            <li>
                                <div class="box5">
                                    <strong> <b> <u>￥</u> <span>${intAmount }</span>.${smallAmount }<br />满<fmt:formatNumber type="number"
                                                    value="${couponExp.conditionAmount }" pattern="0.00" maxFractionDigits="2" />元可用
                                    </b><i class="icon_top"></i><i class="icon_bottom"></i>
                                    </strong>
                                    <div class="item-info">
                                        <h2>${couponExp.couponName }</h2>
                                        <dl>
                                            <dt>所有商品都可以使用</dt>
                                            <dt><fmt:formatDate value="${couponExp.beginTime }" type="date" /> ~ <fmt:formatDate value="${couponExp.endTime }" type="date" /></dt>
                                        </dl>
                                        <b class="icon_expired"></b>
                                    </div>
                                </div>
                            </li>
                        </c:forEach>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div>
    </div>
    
    <c:set var="page_home" value="<%=PublicConstants.PAGE_HOME %>"></c:set>
    <c:set var="page_category" value="<%=PublicConstants.PAGE_CATEGORY %>"></c:set>
    <c:set var="page_quote" value="<%=PublicConstants.PAGE_QUOTE %>"></c:set>
    <c:set var="page_shoppingcart" value="<%=PublicConstants.PAGE_SHOPPING_CART %>"></c:set>
    <c:set var="page_my" value="<%=PublicConstants.PAGE_MY %>"></c:set>
    
    <jsp:include page="../../wx_footer.jsp" />
</body>
</html>